<!--
 * @Author: xuxiuzun 105313046@qq.com
 * @Date: 2022-07-22 09:45:51
 * @LastEditors: xuxiuzun 105313046@qq.com
 * @LastEditTime: 2022-08-19 09:02:15
 * @FilePath: \demo——xin\src\views\modules\basic_settings\operation_log.vue
 * @Description: 这是默认Setup,请Setup`customMade`, 打开koroFileHeader查看配置 进行Setup: https://github.com/OBKoro1/koro1FileHeader/wiki/%E9%85%8D%E7%BD%AE
-->

<!-- 系统Setup板块  --  日志管理页面 -->
<template>
  <div>
    <r-search
      ref="search"
      :searchData="searchData"
      :searchForm="searchForm"
      :searchHandle="searchHandle"
      :inline="true"
      :searchRules="searchRules"
    />

    <r-table
      :isPagination="true"
      :isHandle="true"
      :tableData="tableData"
      :tableCols="tableCols"
      :tablePage="pagination"
      :loading="tableLoading"
      :tableHandles="tableHandles"
      :isSelection="false"
      @refresh="page"
    />
  </div>
</template>

<script>
export default {
  data() {
    return {
      searchData: {
        // operName:'',
        businessType: "",
        params: ""
      },
      searchForm: [
        // { type: "input",label:'', placeholder: "登录者账号", prop: "operName", width: 200 },
        {
          type: "select",
          label: "",
          placeholder: "Operations Type",
          prop: "businessType",
          width: 260,
          options: [
            { value: "0", label: "Other" },
            { value: "1", label: "Add" },
            { value: "2", label: "Amend" },
            { value: "3", label: "Delete" },
            { value: "4", label: "Authorization" },
            { value: "5", label: "Export" },
            { value: "6", label: "Import" },
            { value: "7", label: "Force To Exit" },
            { value: "8", label: "Generating Code" },
            { value: "9", label: "Empty Data" }
          ]
        }
        // { type: "date",label:'', placeholder: "时间范围", prop: "params", width: 200 },
      ],
      searchHandle: [
        {
          type: "primary",
          label: "Search",
          plain: true,
          handle: e => {
            this.zeroFn();
            this.getData();
          }
        }
        // {type:'primary',label:'Reset', handle: e => this.elFormSubmit(),}
      ],
      searchRules: {
        nickName: [
          {
            required: true,
            message: "Please Input Administrator Name",
            trigger: "blur"
          }
        ]
      },

      tableLoading: false,
      tableData: [],
      tableCols: [
        { label: "Log Time", prop: "operTime" },
        { label: "Operations Type", prop: "title" },
        { label: "Operations Personnel", prop: "operName" },
        // { label: 'IP地址', prop: 'operIp' },
        { label: "Content", prop: "remark" }
      ],
      tableHandles: [],
      pagination: { limit: 10, offset: 1, total: 0 },
      checkBox: []
    };
  },
  created() {},
  mounted() {
    this.getData();
  },
  methods: {
    zeroFn() {
      this.pagination.limit = 10;
      this.pagination.offset = 1;
      this.pagination.total = 0;
    },
    async getData() {
      var res = await this.apis.operlog_list({
        pageNum: this.pagination.offset,
        pageSize: this.pagination.limit,
        operName: this.searchData.operName,
        businessType: this.searchData.businessType
        // params:this.searchData.params,
      });
      var list = res.rows || [];
      this.tableData = list;
      this.pagination.total = res.total;
    },
    page() {
      this.getData();
    }
  }
};
</script>

<style scoped></style>
